package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReturnsTheMinimumOfAnArray {
	public static void main(String[] argv) {
		double[] v = new double[]{34.45, 35.45, 36.67, 37.78, 37.0000,
				37.1234, 67.2344, 68.34534, 69.87700};
		System.out.println("数组的最小值:" + min(v));
	}

	public static double min(double[] v) {
		double min = v[0];
		for (int i = 1; i < v.length; i++) {
			if (min > v[i]) {
				min = v[i];
			}
		}
		return (min);
	}

	public static double min(double[][] v) {
		double min = min(v[0]);
		for (int i = 1; i < v.length; i++) {
			if (min > min(v[i])) {
				min = min(v[i]);
			}
		}
		return (min);
	}

	public static int min(int[] v) {
		int min = v[0];
		for (int i = 1; i < v.length; i++) {
			if (min > v[i]) {
				min = v[i];
			}
		}
		return (min);
	}

	public static int min(int[][] v) {
		int min = min(v[0]);
		for (int i = 1; i < v.length; i++) {
			if (min > min(v[i])) {
				min = min(v[i]);
			}
		}
		return (min);
	}
}
